<template>
  <!-- 3.使用School标签 -->
  <div>
    <h2 v-text="msg" ref="title"></h2>
    <button @click="showDom">点我显示DOM元素</button>
    <School ref="sch" />
  </div>
</template>

<script>
//1router.app引入School组件
import School from './components/School';
export default {
  name: 'App',
  //2.注册School组件
  components: { School },
  data() {
    return {
      msg: 'hello,world!!',
    };
  },
  methods: {
    showDom() {
      // console.log(this.$refs);
      console.log(this.$refs.title); //ref用于html标签  获取html元素
      console.log(this.$refs.sch); //ref用于组件标签，获取组件对象
    },
  },
};
</script>
